//
//  HttpWorkTool.swift
//  斗鱼直播Swift
//
//  Created by admin on 2018/2/28.
//  Copyright © 2018年 admin. All rights reserved.
//

import UIKit
import Alamofire
enum MethodType {
    case GET
    case POST
}
class HttpWorkTool: NSObject {
    class func acces(type:MethodType,url:String,parmers:[String:NSString]? = nil,callBack:@escaping (_ result:AnyObject)->())  {
//        let requestHeader:HTTPHeaders = ["Range":"1-3"]; 请求头的设置
        let method = type == .GET ? HTTPMethod.get: HTTPMethod.post
        Alamofire.request(url, method: method, parameters: parmers).responseJSON { (response) in
//            result.result.error?.localizedDescription
            callBack(response as AnyObject)
        }
    }
}

